/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine SDK - core/threads
// Copyright (c) 2014.  All Rights Reserved
//
// File:		AECriticalSection_posix.cpp
// Author:		Gianluca Belardelli
// Date:		01/06/2014
//
/////////////////////////////////////////////////////////////////////////
#include <AECore.h>
#include <core\threads\AECriticalSection.h>

AECriticalSection::AECriticalSection( AEUINT32 nSpinCount )
{
	pthread_mutex_init( &m_csSection, NULL );
}

/// Quit a critical section
AECriticalSection::~AECriticalSection( void )
{
	pthread_mutex_destroy( &m_csSection );
}

/// Lock a critical section
void AECriticalSection::Enter( void )
{
	pthread_mutex_lock( &m_csSection );
}

/// Unlock a critical section
void AECriticalSection::Leave( void )
{
	pthread_mutex_unlock( &m_csSection );
}
